import HttpRequest from './api.request'


// 登录接口
export const login = (params) => HttpRequest.postJson('/user/login',params)

// 菜单接口
export const menus = () => HttpRequest.get('/user/current/menus')

/**应用 start */
export const appList = () => HttpRequest.get('/app/list')
export const appUsed = (id,used) => HttpRequest.get('/app/change/'+id+"/"+used)
export const appDetail = (id) => HttpRequest.get('/app/detail/'+id)
export const appRoles = (id) => HttpRequest.get('/app/roles/'+id)
export const appMenus = (id) => HttpRequest.get('/role/menus/'+id)
export const appAddResource = (params) => HttpRequest.postJson('/role/add/resource',params)
export const appDeleResource = (id) => HttpRequest.get('/role/resource/dele/'+id)
export const appRoleBindedResource = (id) => HttpRequest.get('/role/binded/resource/'+id)
export const appBindsResource = (params) => HttpRequest.postJson('/role/binds/resource',params)
export const userBindRoles = (params) => HttpRequest.postJson('/role/binds/user',params)
export const getAppRoles = (companyUserId) => HttpRequest.get('/role/apps/'+companyUserId)

/**应用 end */

/** 企业管理 start */
export const companySearch = (params) => HttpRequest.postJson('/company/search',params)

export const companyForm = (params) => HttpRequest.postFormData('/company/add',params)

export const companyLoad = (id) => HttpRequest.get('/company/load/'+id)
/** 企业管理 end */

/**商品属性 start */

// 商品属性列表
export const productkinds = () => HttpRequest.get('/admin/productkind/list')

// 商品属性修改
export const productkindmodify = (params) => HttpRequest.postJson('/admin/productkind/modify',params)

// 商品属性删除
export const productkindDele = (id) => HttpRequest.get('/admin/productkind/dele/'+id)

/**商品属性 end */

/**商品分类 start */
export const categorylist = () => HttpRequest.get('/admin/category/list')

export const categorymodify = (params) => HttpRequest.postJson('/admin/category/modify',params)

export const categoryDele = (id) => HttpRequest.get('/admin/category/dele/'+id)

export const categoryForm = (params) => HttpRequest.postFormData('/admin/category/form',params)

/**商品分类 end */

/**商品属性 start */
export const attributeList = (pkid) => HttpRequest.get('/admin/attribute/list/'+pkid)

export const attributeListView = (pkid) => HttpRequest.get('/admin/attribute/listview/'+pkid)

export const attributeModify = (params) => HttpRequest.postJson('/admin/attribute/modify',params)

export const attributeDele = (id) => HttpRequest.get('/admin/attribute/dele/'+id)

/**商品分类 end */

/**  ----------------商品start---------------- */

//添加修改商品
export const productModify = (params) => HttpRequest.postFormData('/admin/product/modify',params)

//查询
export const productSearch = (params) => HttpRequest.postJson('/admin/product/search',params)

export const productLoad = (id) => HttpRequest.get('/admin/product/load/'+id)

export const productLDele = (id) => HttpRequest.get('/admin/product/dele/'+id)

/**  ----------------商品end---------------- */

/**商品分类 end */

/**  ----------------订单start---------------- */

//添加修改商品
export const orderList = (params) => HttpRequest.postJson('/admin/order/search',params)

export const orderDetail = (id) => HttpRequest.get('/admin/order/detail/'+id)

export const orderRefound = (params) => HttpRequest.postJson('/admin/order/refound',params)

/**  ----------------订单end---------------- */


/**  ----------------会员start---------------- */

//加载会员列表
export const memberList = (params) => HttpRequest.postJson('/admin/member/list',params)

/**  ----------------会员end---------------- */

/**  ----------------活动start---------------- */

//加载活动列表
export const activityList = (params) => HttpRequest.get('/admin/activity/list?pagenow='+params.pagenow+"&pagesize=")

//删除活动
export const activityDele = (id) => HttpRequest.get('/admin/activity/dele/'+id)

//添加活动
export const activityModify = (params) => HttpRequest.postJson('/admin/activity/modify',params)

//上线，下线活动
export const activityUped = (params) => HttpRequest.get('/admin/activity/uped/'+params.id+"/"+params.uped)

//活动商品
export const activityProductList = (params) => HttpRequest.postJson('/admin/activity/product/search',params)

//绑定活动商品
export const activityProductBind= (params) => HttpRequest.postJson('/admin/activity/product/bind/'+params.id,params.products)
/**  ----------------活动end---------------- */


/**  ----------------秒杀start---------------- */

//加载活动列表
export const seckillList = (params) => HttpRequest.get('/admin/seckill/list?pagenow='+params.pagenow+"&pagesize=")

//删除活动
export const seckillDele = (id) => HttpRequest.get('/admin/seckill/dele/'+id)

//添加活动
export const seckillModify = (params) => HttpRequest.postJson('/admin/seckill/modify',params)

//上线，下线秒杀
export const seckillUped = (params) => HttpRequest.get('/admin/seckill/uped/'+params.id+"/"+params.uped)

//时间段列表
export const timeperiodList = (id) => HttpRequest.get('/admin/seckill/timeperiod/list?id='+id)

//编辑秒杀时间段
export const timeperiodModify = (params) => HttpRequest.postJson('/admin/seckill/timeperiod/modify',params)

//删除秒杀时间段
export const timeperiodDele = (id) => HttpRequest.get('/admin/seckill/timeperiod/dele/'+id)

//秒杀商品
export const timeperiodProductList = (params) => HttpRequest.postJson('/admin/seckill/timeperiod/product/search',params)

//绑定秒杀商品
export const timeperiodProductBind= (params) => HttpRequest.postJson('/admin/seckill/timeperiod/product/bind',params)

//修改秒杀商品价格
export const timeperiodProductPrice= (params) => HttpRequest.postJson('/admin/seckill/timeperiod/product/price',params)


/**  ----------------秒杀end---------------- */


/**  ----------------优惠卷start---------------- */

//加载优惠卷列表
export const couponList = (params) => HttpRequest.postJson('/admin/coupon/search',params)

//编辑活动
export const couponModify = (params) => HttpRequest.postJson('/admin/coupon/modify',params)

//加载优惠卷
export const couponLoad = (id) => HttpRequest.get('/admin/coupon/load/'+id)


/**  ----------------活动end---------------- */

/**  ----------------权限start---------------- */

//加载用户
export const sysuserList = (params) => HttpRequest.postJson('/admin/sysuser/search',params)


//改变用户密码
export const sysuserChangePassword = (params) => HttpRequest.postJson('/admin/sysuser/changepassword',params)

//改变用户状态
export const sysuserChangeStatus = (params) => HttpRequest.postJson('/admin/sysuser/changestatus',params)

//用户绑定角色
export const sysuserBind = (params) => HttpRequest.postJson('/admin/sysuser/bindrole',params)

//用户拥有的角色
export const sysuserHasRole = (id) => HttpRequest.get('/admin/sysuser/hasrole/'+id)

//加载角色
export const roleList = (params) => HttpRequest.get('/admin/role/list?pagenow='+params.pagenow+"&pagesize="+params.pagesize)

//编辑角色
export const roleModify = (params) => HttpRequest.postJson('/admin/role/modify',params)

//删除角色
export const roleDele = (id) => HttpRequest.get('/admin/role/dele/'+id)

//角色绑定菜单
export const roleBind = (params) => HttpRequest.postJson('/admin/role/bind',params)

//绑定角色
export const roleNotSystemed = (params) => HttpRequest.get('/admin/role/notsystemed',params)

//角色拥有菜单
export const roleHasMenu = (id) => HttpRequest.get('/admin/role/hasmenu/'+id)

//绑定角色
export const sysMenuList = (params) => HttpRequest.get('/admin/role/notsystemed',params)

//修改权限
export const menusModify = (params) => HttpRequest.postJson('/admin/menus/modify',params)

//修改权限
export const menusDele= (id) => HttpRequest.get('/admin/menus/dele/'+id)

/**  ----------------权限end---------------- */